
#include "Physics.hpp"
#include "SceneNode.hpp"

/*
  Combines a physics body with a scene node.
*/
class Sprite
{
	PhysicsBody m_body;
	SceneNode   m_node;
public:

	inline const PhysicsBody& getBody() const { return m_body; }
	inline PhysicsBody&       getBody()       { return m_body; }
	inline void               setBody(const PhysicsBody& body)
	{ m_body = body; }
	
	inline const SceneNode& getNode() const { return m_node; }
	inline SceneNode&       getNode()       { return m_node; }
	inline void             setNode(const SceneNode& node)
	{ m_node = node; }
	
	inline const Xform& getXform() const { return m_body.getXform(); }
	inline Xform&       getXform()       { return m_body.getXform(); }
	inline void         setXform(const Xform& xform)
	{ m_body.setXform(xform); }
	
	inline const Vector& getPos() const { return m_body.getPos(); }
	inline Vector&       getPos()       { return m_body.getPos(); }
	inline void          setPos(const Vector& pos)
	{ m_body.setPos(pos); }
	
	inline const Orientation& getOri() const { return m_body.getOri(); }
	inline Orientation&       getOri()       { return m_body.getOri(); }
	inline void               setOri(const Orientation& ori)
	{ m_body.setOri(orientation); }
	
	// Call once per tick
	void update()
	{
		// Make the scene node track the physics body
		m_node.setXform(m_body.getXform());
	}
};
